import React, { useState } from 'react'
import { Form, Input,Button } from 'antd-mobile'
import axios from 'axios'
export default function Zhang() {
    const [visible] = useState(false)
    let [username, setUsername] = useState('')
    let [password, setpassword] = useState('')
    let deng=()=>{
        axios.post('http://localhost:3000/yzk/login',{username,password}).then(res => {
            console.log(res)
        })
    }
    return (
        <div>
            <h4>账号用户名登陆</h4>
            <div>
                <Form layout='horizontal'>
                    <Form.Item label='用户名' name='username'>
                        <Input placeholder='请输入用户名' clearable value={username}  onChange={(e)=> setUsername(e)} />
                    </Form.Item>
                    <Form.Item
                        label='密码'
                        name='password'
                    >
                        <Input
                            placeholder='请输入密码'
                            clearable
                            type={visible ? 'text' : 'password'}
                            value={password}
                            onChange={(e)=> setpassword(e)}
                        />
                    </Form.Item>
                </Form>
                <Button color='primary' fill='outline' className='but' onClick={()=>{deng()}}>
                    登录
                </Button>
            </div>
        </div>
    )
}
